package com.lipaluma.field.mapper;

import java.lang.reflect.Field;

import com.lipaluma.field.mapper.mapping.MappingInfo;
import com.lipaluma.io.Row;

/**
 * A column must implements this interface to describe the parsing algorithm of the extracted value from the entry file before injecting into the final object
 * @author mario.soares
 */
public interface UnmarshalFieldMapper {

	/**
	 * extract the value from the {@link Row} 
	 * @param row a row of the entry source
	 * @return the value
	 */
	Object unmarshal(Row row);

	/**
	 * describe the FieldMapper by giving information of the FieldMapper like column index, column name, the name of the field, ...<br/>
	 * The description for example used when an error is detected during the process to give the maximum of informations to locate the error.
	 * 
	 * @return the column description
	 */
	String getDescription();
	
	/**
	 * return the field associated to the FieldMapper
	 * @return field the field associated to the FieldMapper
	 */
	Field getField();
	
	MappingInfo[] getMappings();
}
